package com.jinkeen.xiaxie.test

import java.lang.Math.max
import java.lang.Math.min

object MaoPao {
    @JvmStatic
    fun main(args: Array<String>) {
        val arr = intArrayOf(1, 5, 9, 3, 85, 1, 2)
        for (p in 0 until arr.size - 1) {
            var max: Int
            var min: Int
            for (i in 0 until arr.size - p - 1) {
                max = max(arr[i], arr[i + 1])
                min = min(arr[i], arr[i + 1])
                arr[i + 1] = max
                arr[i] = min
            }
        }
        for (i in arr.indices) {
            System.out.println(arr[i])
        }
    }
}